$(($) => {
    let login = $('.login');
    login.on('submit', (e) => {
        let username = $('#username').val();
        let password = $('#password').val();
        password = md5(password)

        console.log(
            username,
            password,
        )
        $.post('/login', { username, password })
            .then(res => {
                if (res.errorCode === 0) {
                    // window.location = '/workLog/index';
                } else if (res.errorCode === -3) {
                    $('.mess').html('没有找到对应的用户, 请检查输入的账号密码是否正确')
                } else {
                    console.error(res);
                }
            })
            .catch(err =>{
                console.error(err);
            })

        return false;
    })
})
